/*

* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Smart-Shop开源商城系统/ Java商城-首选电商平台系统 请务必保留此注释头信息
* |     开源地址: https://gitee.com/ningbo-qishan/gruul-mall
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     可正常分享和学习源码,未经授权 不可商用！
* |     商业版中台购买/开源版商业授权 联系技术客服
* |     官网:  https://www.73app.cn/
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
* |     Copyright (c) 2016-2999 宁波启山智软科技有限公司
* |     版权所有 ,侵权必究！
* ------------------------------------------------------------------------

*/
package com.medusa.gruul.discount.api.model.dto.manager;

import cn.hutool.core.bean.BeanUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.medusa.gruul.discount.api.entity.Coupon;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 *
 * 优惠劵
 *
 * @author lcysike
 * @since 2019-12-09
 */
@Data
@ApiModel(value = "新增或修改优惠劵信息DTO")
public class CouponDto {

    private Long id;

    @ApiModelProperty(value = "优惠劵名称")
    private String name;

    @ApiModelProperty(value = "有效类型： 0-固定时间  1-领劵立即生效")
    @NotNull(message = "有效类型不能为空")
    private Integer effectiveType;

    @ApiModelProperty(value = "有效天数")
    private Integer effectiveDays;

    @ApiModelProperty(value = "开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    @ApiModelProperty(value = "结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    @ApiModelProperty(value = "适用商品类型：  0-全部商品参与  1-指定商品参与  2-指定商品不参与")
    @NotNull(message = "适用商品类型不能为空")
    private Integer productType;

    @ApiModelProperty(value = "优惠劵类型：  0-无门槛折扣劵  1-无门槛现金劵  2-满折劵  3-满减劵")
    @NotNull(message = "优惠劵类型不能为空")
    private Integer couponType;

    @ApiModelProperty(value = "优惠折扣（不能大于10）")
    private BigDecimal discount;

    @ApiModelProperty(value = "优惠金额")
    private BigDecimal discountAmount;

    @ApiModelProperty(value = "满足条件金额")
    private BigDecimal conditionAmount;

    @ApiModelProperty(value = "发行数量")
    @NotNull(message = "发行数量不能为空")
    private Integer issueQuantity;

    @ApiModelProperty(value = "限领(张/人)")
    @NotNull(message = "限领张数不能为空")
    private Integer limitQuantity;

    @ApiModelProperty(value = "优惠劵状态：  0-未开始  1-进行中  2-已结束")
    private Integer status;

    @ApiModelProperty(value = "赠送类型：  0-全民活动  1-赠予客户  2-积分优惠劵")
    @NotNull(message = "赠送类型不能为空")
    private Integer giveType;

    @ApiModelProperty(value = "配置规则：0-不参与回收返券 1-参与回收返券")
    private Integer recycleActivity;

    @ApiModelProperty(value = "回收反券图片")
    private String recycleImg;


    @ApiModelProperty(value = "所需积分")
    private Integer integral;

    @ApiModelProperty(value = "优惠劵关联商品信息")
    private List<CouponProductDto> couponProducts;

    public Coupon coverCoupon() {
        Coupon coupon = new Coupon();
        BeanUtil.copyProperties(this, coupon);
        return coupon;
    }
}
